home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: help with strcmp
- Date: Tue, 02 Apr 96 14:06:19 GMT
- Organization: none
- Distribution: world
- Message-ID: <828453979snz@genesis.demon.co.uk>
- References: <4jpiek$lp6@blaze.cs.jhu.edu> <316196CB.1125@diagram.fr> <4jr75p$onk@sparcserver.lrz-muenchen.de>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4jr75p$onk@sparcserver.lrz-muenchen.de>
- watzka@stat.uni-muenchen.de "Kurt Watzka" writes:
-
- >strcmp() and strncmp() are designed to handle C strings, so they know how
- >to treat '\0' in a string. Otherwise
- >
- > int STRCMP(const char *s1, const char *s2)
- > {
- > size_t sz1 = strlen(s1), sz2 = strlen(s2);
- > return strncpm(s1, s2, sz1 < sz2 ? sz1 : sz2);
- > }
-
- Do you have suppressed yearnings for obsolete OSs? ;-)
-
- >would be a common replacement for the then useless strcmp() function.
-
- Not quite, it would compare "A" and "AB" as equal.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-